﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_UMDRP_M
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtENABLE.Text))
			{
				strErr+="ENABLE格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtIsPublic.Text))
			{
				strErr+="IsPublic格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATEDATE.Text))
			{
				strErr+="CREATEDATE格式错误！\\n";	
			}
			if(this.txtCREATERNAME.Text.Trim().Length==0)
			{
				strErr+="CREATERNAME不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtEDITDATE.Text))
			{
				strErr+="EDITDATE格式错误！\\n";	
			}
			if(this.txtEDITERNAME.Text.Trim().Length==0)
			{
				strErr+="EDITERNAME不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int ENABLE=int.Parse(this.txtENABLE.Text);
			int IsPublic=int.Parse(this.txtIsPublic.Text);
			DateTime CREATEDATE=DateTime.Parse(this.txtCREATEDATE.Text);
			string CREATERNAME=this.txtCREATERNAME.Text;
			DateTime EDITDATE=DateTime.Parse(this.txtEDITDATE.Text);
			string EDITERNAME=this.txtEDITERNAME.Text;

			GPCSC.Model.CL_UMDRP_M model=new GPCSC.Model.CL_UMDRP_M();
			model.ENABLE=ENABLE;
			model.IsPublic=IsPublic;
			model.CREATEDATE=CREATEDATE;
			model.CREATERNAME=CREATERNAME;
			model.EDITDATE=EDITDATE;
			model.EDITERNAME=EDITERNAME;

			GPCSC.BLL.CL_UMDRP_M bll=new GPCSC.BLL.CL_UMDRP_M();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
